#pragma once
#ifdef WIN32
	#include <Windows.h>
	#include <io.h>
#else
	#include <unistd.h>
#endif

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <assert.h>

class CSysFile
{
public:
	CSysFile();
	~CSysFile();
	bool Open(const char* filename,int oflag);
	int Read(void *buffer,unsigned int count);
	//int Pread(void *buffer,unsigned int count,unsigned int offset);
	int Write(const void *buffer,unsigned int count);
	//int Pwrite(void *buffer,unsigned int count,unsigned int offset);
	void Close();
	long Seek(long offset,int origin);
	long Tell();
	bool Sync();
	long GetLength();
	long GetLength(const char* filename);
	bool Setlength(int len);
	bool IsOpened();
	//bool Eof();
private:
	int m_fd;
};





